package com.emm.yixun.common.enums;

import org.apache.commons.lang.StringUtils;

public enum CustomerLevelEnum {

	CUSTOMER_LEVEL_2("2", "A"), CUSTOMER_LEVEL_3("3", "B"), CUSTOMER_LEVEL_4("4", "C"), CUSTOMER_LEVEL_5("5", "D"),;
	private String code;

	private String name;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private CustomerLevelEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public static CustomerLevelEnum getCustomerLevel(String code) {
		if (StringUtils.isBlank(code)) {
			return null;
		}
		for (CustomerLevelEnum menum : values()) {
			if (menum.getCode().equals(code)) {
				return menum;
			}
		}
		return null;
	}
}
